//
//  XOShopHeaderCollectionReusableView.m
//  XiOuMall
//
//  Created by lifayu on 2018/2/23.
//  Copyright © 2018年 lifayu. All rights reserved.
//

#import "XOShopHeaderCollectionReusableView.h"
#import "XOShopModel.h"
#import "UIView+WhenTappedBlocks.h"

@implementation XOShopHeaderCollectionReusableView{
    XOShopModel *_shopModel;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    [self whenTapped:^{
        [self entryShopAction:nil];
    }];
}
- (IBAction)entryShopAction:(UIButton *)sender {
    if(_delegate && [_delegate respondsToSelector:@selector(entryShopAction:)]){
        [_delegate entryShopAction:_shopModel];
    }
}

- (void)setShopModel:(XOShopModel *)shopModel{
    _shopModel = shopModel;
    self.shopNameLabel.text = shopModel.shopName;
    [self.shopLogoImageView setImageWithUrl:shopModel.logo];
    self.shopInfoLabel.text = [NSString stringWithFormat:@"📢: %@", shopModel.intro];
}

@end
